//
// Created by ywl on 2017-12-3.
//

#ifndef WLPLAYER_BUFFERQUEUE_H
#define WLPLAYER_BUFFERQUEUE_H

#include "queue"
#include "MinePlayStatus.h"
#include "PcmDataBean.h"
#include "pthread.h"

extern "C"
{
#include <libavcodec/avcodec.h>

};

class WlBufferQueue {

public:
    std::deque<PcmDataBean *> queueBuffer;
    pthread_mutex_t mutexBuffer;
    pthread_cond_t condBuffer;
    MinePlayStatus *wlPlayStatus = NULL;

public:
    WlBufferQueue(MinePlayStatus *playStatus);
    ~WlBufferQueue();
    int putBuffer(SAMPLETYPE *buffer, int size);
    int getBuffer(PcmDataBean **pcmBean);
    int clearBuffer();

    void release();
    int getBufferSize();

    int noticeThread();
};


#endif //WLPLAYER_BUFFERQUEUE_H
